package com.fcscs.cservice.client.common;

import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.fcscs.core.gwt.common.CoreConstants;
import com.fcscs.share.gwt.common.ShareGWTConstants;

public class MessageBoxTools {
	
	public static void messageAlertSystemError(){
		MessageBox.alert(CoreConstants.CORE_MESSAGES.operation(CoreConstants.CORE_CONSTANTS.system(), ShareGWTConstants.SHARE_GWT_CONSTANTS.error()),
				CoreConstants.CORE_CONSTANTS.systemError(), null);
	}
	
	public static void messageAlertEnterSearchTerm(final TextField<String> sTerm){
		MessageBox.alert(null,
				CoreConstants.CORE_CONSTANTS.enterSearchTermSimple(),new Listener<MessageBoxEvent>() {
					
					@Override
					public void handleEvent(MessageBoxEvent be) {
						sTerm.focus();
					}
				});
	}
	
	public static void messageAlertEnterSearchTerm(){
		MessageBox.alert(null,CoreConstants.CORE_CONSTANTS.enterSearchTermSimple(),null);
	}
	
	public static void messageAlertSystemMessage(String action){
		MessageBox.alert(null,action, null);
	}
	
	public static void messageAlerMessage(String messge,final TextField<String> textFild){
		MessageBox.alert(null, messge,new Listener<MessageBoxEvent>() {
			
			@Override
			public void handleEvent(MessageBoxEvent be) {
				textFild.focus();
			}
		});
	}
	

}
